 /*
  * Copyright (c) 2006, 2023, wuyahan 编写
  *
  */
 package com.repair.controller;

 import com.repair.entity.model.TableData;
 import com.repair.util.R;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;

 import java.time.LocalDate;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;

 /**
  * <p>Project: server_zhang - TestController
  * <p>Powered by wuyahan On 2023-04-11 08:52:21
  *
  * @author wuyahan [tianwenle2000@163.com]
  * @version 1.0
  * @since 17
  */
 @RestController
 @RequestMapping("/api/user")
 public class TestController {

     @RequestMapping("/test1")
     public String getTest() {
         return "123";
     }

     // 第1页  2
     // 第2页  2
     @RequestMapping("/getInfo/{curPage}/{pageSize}")
     public R getInfo(@PathVariable Integer curPage, @PathVariable Integer pageSize){
        // list set Queue  []
         /**
          * Map
          *
          * {
          *     total: 3,
          *     list: [
          *         {}
          *     ]
          * }
          */
         ArrayList<TableData> list = new ArrayList<>();

         list.add(new TableData(LocalDate.now().toString(),"情韵1","河南省郑州市1"));
         list.add(new TableData(LocalDate.now().toString(),"情韵2","河南省郑州市2"));
         list.add(new TableData(LocalDate.now().toString(),"情韵3","河南省郑州市3"));

         //
         List<TableData> tableData = list.subList(curPage - 1, pageSize);

         HashMap<String, Object> map = new HashMap<>();

         map.put("list",tableData);
         map.put("total",list.size());


         return R.ok().data(map);
     }

 }
